"use strict";
/* Controllers */
app.controller("addServiceController", ['$scope', '$location', '$rootScope', '$routeParams', 'addService',
    function ($scope, $location, $rootScope, $routeParams, addService) {
        var vm = $scope.vm = {};
        vm.p = {};
        var errorFn = function (result) {
            console.log('error func .......')
            alert(result);
        };


        $scope.setDimDefine = function () {
            var vm = $scope.vm;
            var params = vm.p;
            var procFn = function (response) {
                if (response.success && response.data) {
                    alert("执行成功！")
                } else {

                   alert('添加失败,失败原因:'+response.message);
                }
            };

            return addService.setDimDefine(params, procFn, errorFn);
        };
        // $scope.setDimDefine(); 注释掉，防止每次刷新页面，新增记录


}]);


/* Services */
app.service('addService', ['ajaxService', function (ajaxService) {
    this.setDimDefine = function (params, successFunction, errorFunction) {
       return  ajaxService.AjaxPost(params, "/star/api/basic-service/v1/data_content/addServiceItem.do", successFunction, errorFunction);
    };
}]);



